package com.nxn.core.web.tag;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.Validate;

/**
 * Represents the bundle element contents.
 * 
 * @author Michael Zhang
 */
public class Bundles implements Serializable {
	private static final long serialVersionUID = -3391768095969610227L;
	
	private List<String> javascripts = new ArrayList<String>();
	private List<String> stylesheets = new ArrayList<String>();
	private List<String> images = new ArrayList<String>();

	/**
	 * Returns a JavaScript files list.
	 * 
	 * @return The List, never be null.
	 */
	public List<String> getJavaScripts() {
		return javascripts;
	}

	/**
	 * Adds a JavaScript file into the list.
	 * 
	 * @param src
	 *            The file, can not be empty.
	 * 
	 * @throws IllegalArgumentException
	 *             Thrown when the "src" is empty.
	 */
	public void addJavaScript(String src) throws IllegalArgumentException {
		Validate.notEmpty(src, "The 'src' is empty");

		javascripts.add(src);
	}

	/**
	 * Returns a StyleSheet files list.
	 * 
	 * @return The List, never be null.
	 */
	public List<String> getStyleSheets() {
		return stylesheets;
	}

	/**
	 * Adds a StyleSheet file into the list.
	 * 
	 * @param src
	 *            The file, can not be empty.
	 * 
	 * @throws IllegalArgumentException
	 *             Thrown when the "src" is empty.
	 */
	public void addStyleSheet(String src) throws IllegalArgumentException {
		Validate.notEmpty(src, "The 'src' is empty");

		stylesheets.add(src);
	}

	/**
	 * Returns a Image files list.
	 * 
	 * @return The List, never be null.
	 */
	public List<String> getImages() {
		return images;
	}

	/**
	 * Adds a Image file into the list.
	 * 
	 * @param src
	 *            The file, can not be empty.
	 * 
	 * @throws IllegalArgumentException
	 *             Thrown when the "src" is empty.
	 */
	public void addImage(String src) throws IllegalArgumentException {
		Validate.notEmpty(src, "The 'src' is empty");

		images.add(src);
	}
}
